s = int('Введите скобочную последовательность : ')
s1 = ''

for c in s:
    if c =='(':
        s1 += c

    if c == ')':
        if len(s1) > 0:
            if [len(s1)- 1] == ')':
                s1 = s1[:-1]

     if c =='{':
        s1 += c

    if c == '}':
        if len(s1) > 0:
            if [len(s1)- 1] == '{':
                s1 = s1[:-1]

     if c =='[':
        s1 += c

    if c == ']':
        if len(s1) > 0:
            if [len(s1)- 1] == '[':
                s1 = s1[:-1]

     if c =='<':
        s1 += c

    if c == '>':
        if len(s1) > 0:
            if [len(s1)- 1] == '<':
                s1 = s1[:-1]

    print(s1)
print(s1)

if len(s1) == 0:
        print(True)
else:
        print(False)
